package com.huabo.audit.oracle.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.UpdateProvider;

import com.hbfk.util.PageInfo;
import com.huabo.audit.oracle.entity.TblNbsjAuditplan;
import com.huabo.audit.oracle.entity.TblNbsjPlanProject;
import com.huabo.audit.oracle.vo.TblNbsjPlanProjectVo;

import io.lettuce.core.dynamic.annotation.Param;

public interface TblNbsjPlanProjectMapper{

	@InsertProvider(type=TblNbsjPlanProjectMapperSqlConfig.class,method="insertEntity")
	@Options(useGeneratedKeys=true, keyProperty="planprojectid", keyColumn="PLANPROJECTID")
	void insertEntity(TblNbsjPlanProject project) throws Exception;

	@UpdateProvider(type=TblNbsjPlanProjectMapperSqlConfig.class,method="updateEntity")
	void updateEntity(TblNbsjPlanProject project) throws Exception;

	@Delete("DELETE FROM TBL_NBSJ_PLANPROJECT WHERE PLANPROJECTID = #{planprojectid}")
	void deletePlanProjectInfo(@Param("planprojectid")Integer planprojectid) throws Exception;

	@Delete("DELETE FROM TBL_NBSJ_PLANPROJECT WHERE PLANID = #{planId}")
	void deletePlanProjectByPlanId(@Param("planId")Integer planId) throws Exception;

	@Select("SELECT PLANPROJECTID,PROJECTNAME,TARGETNAME,FINISHTIME,ORGIDS,ORGIDNAMES,EXTERNALASSIG,PLANID,BSJTYPE "
			+ "FROM TBL_NBSJ_PLANPROJECT WHERE PLANID = #{planId} "
			+ " ORDER BY PLANPROJECTID ")
	@Results({
		@Result(column="PLANPROJECTID",property="planprojectid"),
		@Result(column="PROJECTNAME",property="projectname"),
		@Result(column="TARGETNAME",property="targetname"),
		@Result(column="FINISHTIME",property="finishtime"),
		@Result(column="ORGIDS",property="orgids"),
		@Result(column="ORGIDNAMES",property="orgidnames"),
		@Result(column="EXTERNALASSIG",property="externalassig"),
		@Result(column="PLANID",property="planid"),
		@Result(column="BSJTYPE",property="bsjtype"),
	})
	List<TblNbsjPlanProject> selectPlanProjectListInfoByPlanId(@Param("planId")Integer planId);

	@SelectProvider(type=TblNbsjPlanProjectMapperSqlConfig.class,method="selectPlanProjectListByPageInfo")
	@Results({
		@Result(column="PLANPROJECTID",property="planprojectid"),
		@Result(column="PROJECTNAME",property="projectname"),
		@Result(column="TARGETNAME",property="targetname"),
		@Result(column="FINISHTIME",property="finishtime"),
		@Result(column="ORGIDNAMES",property="orgidnames"),
		@Result(column="EXTERNALASSIG",property="externalassig"),
	})
	List<TblNbsjPlanProject> selectPlanProjectListByPageInfo(TblNbsjPlanProjectVo project, PageInfo<TblNbsjPlanProject> pageInfo) throws Exception;
	
	@SelectProvider(type=TblNbsjPlanProjectMapperSqlConfig.class,method="selectPlanProjectCountByPageInfo")
	Integer selectPlanProjectCountByPageInfo(TblNbsjPlanProjectVo project, PageInfo<TblNbsjPlanProject> pageInfo) throws Exception;

	


}
